<%--
  Created by IntelliJ IDEA.
  User: Shinelon
  Date: 2018-06-01
  Time: 9:58
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<link rel="stylesheet" href="${pageContext.request.contextPath}/statics/bootstrap/css/bootstrap.css"/>
<link rel="stylesheet" href="${pageContext.request.contextPath}/statics/table/bootstrap-table.min.css"/>
<script type="text/javascript" src="${pageContext.request.contextPath}/statics/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/statics/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/statics/table/bootstrap-table.min.js"></script>
<script type="text/javascript"
        src="${pageContext.request.contextPath}/statics/table/locale/bootstrap-table-zh-CN.min.js"></script>
<link rel="stylesheet" href="${pageContext.request.contextPath}/statics/date/bootstrap-datetimepicker.min.css"/>
<script type="text/javascript" src="${pageContext.request.contextPath}/statics/date/Moment.js"></script>
<script type="text/javascript"
        src="${pageContext.request.contextPath}/statics/date/bootstrap-datetimepicker.min.js"></script>

<!--mini ui-->
<%--<link href="${pageContext.request.contextPath}/statics/miniui/miniui.css" rel="stylesheet"--%>
<%--type="text/css"/>--%>
<%--<script src="${pageContext.request.contextPath}/statics/miniui/miniui.js"--%>
<%--type="text/javascript"></script>--%>


<%--win10-ui--%>
<script type="text/javascript" src="${pageContext.request.contextPath}/win10-ui/js/win10.child.js"></script>

<!--easyui-->
<link rel="stylesheet" type="text/css"
      href="${pageContext.request.contextPath}/statics/easyui/easyui.css">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/statics/easyui/icon.css">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/statics/easyui/demo.css">

<script type="text/javascript" src="${pageContext.request.contextPath}/statics/easyui/jquery.easyui.min.js"></script>

<script type="text/javascript" src="${pageContext.request.contextPath}/statics/js/kucun.js"></script>

<html>
<head>
    <title>Title</title>
</head>
<body>

<div class="panel panel-default">
    <div class="panel-body">
        <form class="form-inline">
            <div class="form-group">
                <input id="name" type="text" class="form-control" placeholder="搜索内容">
            </div>
            <div class="form-group">类别：
                <input id="lei" class="easyui-combogrid" style="width:200px" data-options="
                                                panelWidth: 300,
                                                idField: 'id',
                                                textField: 'name',
                                                url: '${pageContext.request.contextPath}/commtype/list',
                                                method: 'get',
                                                columns: [[
                                                    {field:'id',title:'类别id',width:100},
                                                    {field:'name',title:'分类名称',width:150},
                                                ]],
                                                fitColumns: true
                                            ">
            </div>
            <div class="form-group">仓库：
                <input id="chang" class="easyui-combogrid" style="width:200px" data-options="
                                                panelWidth: 300,
                                                idField: 'id',
                                                textField: 'name',
                                                url: '${pageContext.request.contextPath}/war/query',
                                                method: 'get',
                                                columns: [[
                                                    {field:'id',title:'仓库id',width:100},
                                                    {field:'name',title:'仓库名称',width:150},
                                                    {field:'phone',title:'联系电话',width:180},
                                                    {field:'address',title:'联系地址',width:200},
                                                ]],
                                                fitColumns: true
                                            ">
            </div>

            <button onclick="search()" type="button" class="btn btn-default">查询</button>
        </form>
    </div>
</div>




<table id="table"></table>



<%--添加新商品--%>
<!-- Modal -->
<div class="modal fade" id="myModal3">
    <div class="modal-dialog" style="width:600px;height:303px;"
         role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"
                        aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title" id="myModalLabel3">增加新商品</h4>
            </div>
            <div class="modal-body">
                <!-- form开始 -->
                <form id="jvForm" action="" method="post"
                      enctype="multipart/form-data">
                    <input type="hidden" id="id">
                    <div class="form-group">
                        <label for="name" style="float: left;">货品编号:</label>
                        <input type="text" class="form-control" id="bian" readonly="readonly"    placeholder="请输入商品编号">
                    </div>
                    <div class="form-group">
                        <label for="name" style="float: left;">货品名称:</label>
                        <input type="text" class="form-control" id="nname" placeholder="请输入商品名称">
                    </div>
                    <div class="form-group">
                        <label for="name" style="float: left;"><a onclick="tiandan()">(添加单位)</a>单&emsp;&emsp;位:</label>
                        <select id="dw1" class="form-control" >
                            <option value="-1">请选择</option>
                        </select>
                    </div>
                    <div class="form-group">
                        <label for="name" style="float: left;">规格型号:</label>
                        <input type="text" class="form-control" id="xh" placeholder="请输入规格型号">
                    </div>
                    <div class="form-group">
                        <label for="name" style="float: left;"><a onclick="tianyan()">(添加颜色)</a>颜&emsp;&emsp;色:</label>
                        <select id="ys1" class="form-control" >
                            <option value="-1">请选择</option>
                        </select>
                    </div>
                    <div class="form-group">
                        <label for="name" style="float: left;"><a onclick="tianyan()">(添加分类)</a>分&emsp;&emsp;类:</label>
                        <select id="fl" class="form-control" >
                            <option value="-1">请选择</option>
                        </select>
                    </div>
                    <div class="form-group">
                        <label for="name" style="float: left;">进&emsp;&emsp;价:</label>
                        <input type="text" class="form-control" id="money" placeholder="请输入价格">
                    </div>
                    <div class="form-group">
                        <label for="name" style="float: left;">卖&emsp;&emsp;价:</label>
                        <input type="text" class="form-control" id="money2" placeholder="请输入价格">
                    </div>
                    <div class="form-group">
                        <label for="name" style="float: left;">库存数量:</label>
                        <input type="text" class="form-control" id="sum1" readonly="readonly" placeholder="请输入商品数量">
                    </div>
                    <div class="form-group">
                        <label for="name" style="float: left;">库存警戒数量:</label>
                        <input type="text" class="form-control" id="sum3"  placeholder="请输入商品数量">
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                        <button onclick="uuu()" type="button"
                                class="btn btn-primary" data-dismiss="modal">提交</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>




</body>
<script type="text/javascript">
    $(function(){
        $.post("${pageContext.request.contextPath}/comp/query",function (releset) {
            var e=releset;
            $(e).each(function (i,e) {
                $('#dw1').append('<option value='+e.id+' >'+e.name+'</option>');
            })
        })
        $.post("${pageContext.request.contextPath}/color/query",function (releset) {
            var e=releset;
            $(e).each(function (i,e) {
                $('#ys1').append('<option value='+e.id+' >'+e.name+'</option>');
            })
        })
        $.post("${pageContext.request.contextPath}/commtype/list",function (releset) {
            var e=releset;
            $(e).each(function (i,e) {
                $('#fl').append('<option value='+e.id+' >'+e.name+'</option>');
            })
        })
    })

    function uuu(){

        var id = $("#id").val();
        var name1 = $("#nname").val();
        var companyid = $("#dw1").val();
        var spec = $("#xh").val();
        var colorid = $("#ys1").val();
        var typeid = $("#fl").val();
        var bprice = $("#money").val();
        var eprice = $("#money2").val();
        var miniin = $("#sum3").val();
        $.post("${pageContext.request.contextPath}/commodity/upd", {"id":id, "name": name1, "companyid":companyid, "spec":spec, "colorid":colorid,"typeid":typeid,"bprice":bprice,"eprice":eprice,"miniin":miniin},function(data){
            $("#table").bootstrapTable("load",data)
        })


    }
</script>
</html>
